package com.xiaoxie.report.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xiaoxie.common.constant.Constants;
import com.xiaoxie.report.domain.ReportConfig;
import com.xiaoxie.report.domain.dto.QueryReportConfigDto;
import com.xiaoxie.report.domain.vo.ReportConfigVO;
import com.xiaoxie.report.mapper.ReportConfigMapper;
import com.xiaoxie.report.service.ReportConfigService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class ReportConfigServiceImpl implements ReportConfigService {

    @Resource
    private ReportConfigMapper reportConfigMapper;


    @Override
    public String getConfigSqlTemplateByReportId(Integer reportId) {
        return reportConfigMapper.getConfigSqlTemplateByReportId(reportId);
    }

    @Override
    public PageInfo<ReportConfigVO> getReportConfigList(Integer pageNum, QueryReportConfigDto queryReportConfigDto) {
        PageHelper.startPage(pageNum, Constants.PAGE_SIZE);
        List<ReportConfigVO> reportConfigVOS = reportConfigMapper.getReportConfigList(queryReportConfigDto);
        return new PageInfo<>(reportConfigVOS);
    }
}
